package com.ruoyi.web.controller.system;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.system.service.ISysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.model.RegisterBody;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.framework.web.service.SysRegisterService;
import com.ruoyi.system.service.ISysConfigService;

import java.util.List;

/**
 * 注册验证
 *
 * @author ruoyi
 */
@RestController
@RequestMapping()
public class SysRegisterController extends BaseController {
    @Autowired
    private SysRegisterService registerService;

    @Autowired
    private ISysConfigService configService;
    @Autowired
    private ISysUserService userService;

    @PostMapping("/registers")
    public AjaxResult register(@RequestBody RegisterBody user) {
        System.out.println("mapper.SysUserMapper.insert");
        SysUser sysUser = new SysUser();
        sysUser.setUserName("罗继全1");
        Boolean flag = userService.save(sysUser);
        System.out.println(flag);
        if (flag) {
            return AjaxResult.success();
        }
        return AjaxResult.error();

    }

    /**
     * 查询用户列表
     * @return
     */
    @GetMapping("/queryUserList")
    public AjaxResult queryUserList() {
        List<SysUser> sysUsers = userService.list();
        return AjaxResult.success(sysUsers);
    }



}
